<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  function search (arr, val) {
    for (let i = 0; i < arr.length; i ++) {
      if (arr[i] === val) return i
    }
    return -1
  }

  console.log(search([5, 3, 2, 9, 7], 10))
</script>
</body>
</html>
